Optimal. Leaf size=55 \[ -\frac{a \sin (e+f x) \cos (e+f x)}{2 f}+\frac{a x}{2}+\frac{b \cos ^3(e+f x)}{3 f}-\frac{b \cos (e+f x)}{f} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.044637, antiderivative size = 55, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 4, integrand size = 19, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.21, Rules used = {2748, 2635, 8, 2633} \[ -\frac{a \sin (e+f x) \cos (e+f x)}{2 f}+\frac{a x}{2}+\frac{b \cos ^3(e+f x)}{3 f}-\frac{b \cos (e+f x)}{f} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2748
Rule 2635
Rule 8
Rule 2633
Rubi steps
\begin{align*} \int \sin ^2(e+f x) (a+b \sin (e+f x)) \, dx &=a \int \sin ^2(e+f x) \, dx+b \int \sin ^3(e+f x) \, dx\\ &=-\frac{a \cos (e+f x) \sin (e+f x)}{2 f}+\frac{1}{2} a \int 1 \, dx-\frac{b \operatorname{Subst}\left (\int \left (1-x^2\right ) \, dx,x,\cos (e+f x)\right )}{f}\\ &=\frac{a x}{2}-\frac{b \cos (e+f x)}{f}+\frac{b \cos ^3(e+f x)}{3 f}-\frac{a \cos (e+f x) \sin (e+f x)}{2 f}\\ \end{align*}
Mathematica [A] time = 0.0578861, size = 60, normalized size = 1.09 \[ \frac{a (e+f x)}{2 f}-\frac{a \sin (2 (e+f x))}{4 f}-\frac{3 b \cos (e+f x)}{4 f}+\frac{b \cos (3 (e+f x))}{12 f} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.014, size = 49, normalized size = 0.9 \begin{align*}{\frac{1}{f} \left ( -{\frac{b \left ( 2+ \left ( \sin \left ( fx+e \right ) \right ) ^{2} \right ) \cos \left ( fx+e \right ) }{3}}+a \left ( -{\frac{\sin \left ( fx+e \right ) \cos \left ( fx+e \right ) }{2}}+{\frac{fx}{2}}+{\frac{e}{2}} \right ) \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.62178, size = 65, normalized size = 1.18 \begin{align*} \frac{3 \,{\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} a + 4 \,{\left (\cos \left (f x + e\right )^{3} - 3 \, \cos \left (f x + e\right )\right )} b}{12 \, f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.59012, size = 120, normalized size = 2.18 \begin{align*} \frac{2 \, b \cos \left (f x + e\right )^{3} + 3 \, a f x - 3 \, a \cos \left (f x + e\right ) \sin \left (f x + e\right ) - 6 \, b \cos \left (f x + e\right )}{6 \, f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 0.918767, size = 92, normalized size = 1.67 \begin{align*} \begin{cases} \frac{a x \sin ^{2}{\left (e + f x \right )}}{2} + \frac{a x \cos ^{2}{\left (e + f x \right )}}{2} - \frac{a \sin{\left (e + f x \right )} \cos{\left (e + f x \right )}}{2 f} - \frac{b \sin ^{2}{\left (e + f x \right )} \cos{\left (e + f x \right )}}{f} - \frac{2 b \cos ^{3}{\left (e + f x \right )}}{3 f} & \text{for}\: f \neq 0 \\x \left (a + b \sin{\left (e \right )}\right ) \sin ^{2}{\left (e \right )} & \text{otherwise} \end{cases} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.68803, size = 68, normalized size = 1.24 \begin{align*} \frac{1}{2} \, a x + \frac{b \cos \left (3 \, f x + 3 \, e\right )}{12 \, f} - \frac{3 \, b \cos \left (f x + e\right )}{4 \, f} - \frac{a \sin \left (2 \, f x + 2 \, e\right )}{4 \, f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]